import { util } from '../common/util.js'
import { config } from '../config.js'

export default {
  updateDebugSetting (state, changed) {
		let debugSetting = util.getLocalStorage('debugSetting_' + config.appName) || {};
		state.debugSetting = Object.assign(debugSetting, changed);
    util.setLocalStorage(
		  'debugSetting_' + config.appName, 
			Object.assign(debugSetting, changed)
		);
  },
	updateToken (state, changed) {
		let expire = 10*60*60*1000;// 过期时间,单位为毫秒
		state.token = changed;
		if(changed == '')
			util.delLocalStorage('token_' + config.appName);
		else
			util.setLocalStorage('token_' + config.appName, changed, expire);
	}
};